package com.buddy.syn.block._03;

public class Task {
    private String getDate1;
    private String getDate2;
    public void doLongTimeTask(){
        try {
            System.out.println("begin task!");
            Thread.sleep(3000);
            getDate1 = "长时间处理任务后，从远程返回的值1 ThreadName= "
                    +Thread.currentThread().getName();
            getDate2 = "长时间处理任务后，从远程返回的值2 ThreadName= "
                    +Thread.currentThread().getName();
            synchronized (this){
                System.out.println(getDate1);
                System.out.println(getDate2);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}